package com.realife.eson.common.config.mq;


import com.realife.eson.common.constant.MQConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MQEQBConfig {


    //@Bean Binding，Queue，Exchange
    @Bean
    public Queue envCreateQueue() {
        Queue queue = new Queue(MQConstant.ENV_CREATE_QUEUE, true, false, false);
        return queue;
    }

    @Bean
    public Exchange envEventExchange() {
        //String name, boolean durable, boolean autoDelete, Map<String, Object> arguments
        return new TopicExchange(MQConstant.ENV_EXCHANGE, true, false);
    }

    @Bean
    public Binding envCreateEnvBinding() {
        //String destination, DestinationType destinationType, String exchange, String routingKey,
        //			Map<String, Object> arguments
        return new Binding(MQConstant.ENV_CREATE_QUEUE,
                Binding.DestinationType.QUEUE,
                MQConstant.ENV_EXCHANGE,
                MQConstant.ENV_CREATE_RK,
                null);
    }



    //

}
